/******************************************************************************
 * Copyright 2024 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#pragma once

#include <memory>
#include <string>
#include <vector>

#include "modules/perception/common/base/object.h"
#include "modules/perception/common/lib/interface/base_init_options.h"
#include "modules/perception/common/lib/registerer/registerer.h"
#include "modules/perception/common/lidar/common/object_sequence.h"
#include "modules/perception/lidar_tracking/tracker/common/tracked_object.h"

namespace apollo {
namespace perception {
namespace lidar {

using apollo::perception::BaseInitOptions;

struct TypeFilterInitOption : public BaseInitOptions {
    bool debug_log = false;
};

struct TypeFilterOption {};

class BaseSingleShotTypeFusion {
 public:
    virtual bool Init(const TypeFilterInitOption& option) = 0;

    virtual bool TypeFusion(const TypeFilterOption& option,
        TrackedObjectPtr new_object) = 0;

    virtual std::string Name() const = 0;
};

PERCEPTION_REGISTER_REGISTERER(BaseSingleShotTypeFusion);
#define PERCEPTION_REGISTER_ONESHOTTYPEFUSION(name) \
    PERCEPTION_REGISTER_CLASS(BaseSingleShotTypeFusion, name)

class BaseMultiShotTypeFusion {
 public:
    typedef ObjectSequence::TrackedObjects TrackedObjects;

 public:
    virtual bool Init(const TypeFilterInitOption& option) = 0;

    virtual bool TypeFusion(const TypeFilterOption& option,
        const std::vector<TrackedObjectConstPtr>& tracked_objects,
            TrackedObjectPtr new_object) = 0;

    virtual std::string Name() const = 0;
};

PERCEPTION_REGISTER_REGISTERER(BaseMultiShotTypeFusion);
#define PERCEPTION_REGISTER_SEQUENCETYPEFUSION(name) \
    PERCEPTION_REGISTER_CLASS(BaseMultiShotTypeFusion, name)

}  // namespace lidar
}  // namespace perception
}  // namespace apollo
